"""Create a website evaluation table for storing the evaluation results from the Frontend QA Agent app

Revision ID: 48bf142a794c
Revises: 0d328a61b91f
Create Date: 2025-07-17 23:41:03.949766+00:00

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '48bf142a794c'
down_revision: Union[str, None] = '0d328a61b91f'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('website_evaluations',
    sa.Column('id', sa.UUID(), nullable=False),
    sa.Column('linked_account_id', sa.UUID(), nullable=False),
    sa.Column('url', sa.String(length=255), nullable=False),
    sa.Column('status', sa.Enum('IN_PROGRESS', 'COMPLETED', 'FAILED', name='websiteevaluationstatus', native_enum=False, length=50), nullable=False),
    sa.Column('result', sa.Text(), nullable=False),
    sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
    sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
    sa.ForeignKeyConstraint(['linked_account_id'], ['linked_accounts.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('linked_account_id', 'url', name='uc_linked_account_url')
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('website_evaluations')
    # ### end Alembic commands ###
